package com.example.bodyadvice.controller;

import com.example.bodyadvice.config.HttpBodyDecrypt;
import com.example.bodyadvice.entity.HttpResult;
import com.example.bodyadvice.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@HttpBodyDecrypt
public class UserController {
    @GetMapping("/userInfo")
    public User userInfo(User user) {
        return user;
    }

    @GetMapping("/userInfo2")
    public HttpResult<User> userInfo2(String name) {
        HttpResult httpResult = new HttpResult(HttpResult.failCode, "数据库无数据", null);
        return httpResult;
    }

    @PostMapping("/user")
    public User user(@RequestBody User user) {
        return user;
    }
}
